package com.example.demo.web.api

import com.example.demo.data.Ingredient
import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport

class IngredientResourceAssembler : RepresentationModelAssemblerSupport<Ingredient, IngredientResource>(
        Ingredient::class.java, IngredientResource::class.java
) {

    override fun instantiateModel(entity: Ingredient): IngredientResource {
        return IngredientResource(entity)
    }

    override fun toModel(entity: Ingredient): IngredientResource {
        return createModelWithId(entity.id, entity)
    }
}